package com.eclipse.e0114_java8.课堂案列;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Test3_排序 {
	static List<String> list = Arrays.asList("1", "22", "333", "333", "333","1");

	public static void main(String[] args) {
		Stream<String> stream = list.stream();

//		stream.forEach(System.out::println);
		System.out.println(stream.filter(t -> t.length() > 2).limit(2).count());

		System.out.println("---------------------------------------------");
		stream = list.stream();

		List<String> result = stream.sorted((o1, o2) -> o1.length() - o2.length()).limit(10)
				.collect(Collectors.toList());

		result.forEach(t -> System.out.println(t));
	}

}
